package com.enation.app.javashop.core.client.fallback.system;

import com.enation.app.javashop.core.client.feignimpl.system.ValidatorClientFeignImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 验证码client factory
 * @author kingapex
 * @version 1.0
 * @data 2022/5/27 22:10
 **/
@Component
public class ValidatorClientFallbackFactory extends BaseFallbackFactory<ValidatorClientFeignImpl> implements FallbackFactory {

    @Override
    protected ValidatorClientFeignImpl fallback() {
        return new ValidatorClientFallback();
    }


    /**
     * @author fk
     * @version v2.0
     * @Description: 验证断路器
     * @date 2020/3/2 14:26
     * @since v7.2
     */
    @Component
    public static class ValidatorClientFallback implements ValidatorClientFeignImpl {

        protected final Log logger = LogFactory.getLog(this.getClass());

        @Override
        public void validate() {
            logger.error("系统服务出现异常");
        }
    }
}
